﻿using System;
using fastCSharp;
using fastCSharp.code.cSharp;

namespace diantou.dataModel.path
{
    /// <summary>
    /// 在线测试问题URL
    /// </summary>
    public struct problem
    {
        /// <summary>
        /// OJ问题标识
        /// </summary>
        public int Id;
        /// <summary>
        /// 
        /// </summary>
        public string Query
        {
            get { return "problemId=" + Id.toString(); }
        }
        /// <summary>
        /// 
        /// </summary>
        public string AndQuery
        {
            get { return "&problemId=" + Id.toString(); }
        }
        /// <summary>
        /// 格式化URL
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        private webView.hashUrl get(string path)
        {
            return new webView.hashUrl { Path = path, Query = Query };
        }
        /// <summary>
        /// 代码测试
        /// </summary>
        public webView.hashUrl CodeJudge
        {
            get { return get("/onlineJudge/questionCode.html"); }
        }
        ///// <summary>
        ///// 数据测试
        ///// </summary>
        //public webView.hashUrl DataJudge
        //{
        //    get { return get("/onlineJudge/questionAnswer.html"); }
        //}
        /// <summary>
        /// 程序测试运行效率AC排行
        /// </summary>
        public webView.hashUrl AcceptedUser
        {
            get { return get("/onlineJudge/solutionRank.html"); }
        }
        /// <summary>
        /// 程序测试AC排行
        /// </summary>
        public webView.hashUrl AcceptedUserSubmit
        {
            get
            {
                return get("/onlineJudge/acceptedRank.html");
            }
        }
        /// <summary>
        /// 程序测试记录
        /// </summary>
        public webView.hashUrl Judge
        {
            get { return get("/onlineJudge/problemJudge.html"); }
        }
        /// <summary>
        /// 相关收藏
        /// </summary>
        public webView.hashUrl Favorite
        {
            get { return get("/onlineJudge/favorite.html"); }
        }
        /// <summary>
        /// 比赛
        /// </summary>
        public webView.hashUrl Contest
        {
            get { return get("/contest/problem.html"); }
        }
        /// <summary>
        /// 题解
        /// </summary>
        public webView.hashUrl ContestSolution
        {
            get { return get("/contest/problemSolution.html"); }
        }
        /// <summary>
        /// 题解
        /// </summary>
        public webView.hashUrl Solution
        {
            get { return get("/onlineJudge/problemSolution.html"); }
        }
        /// <summary>
        /// 比赛测试运行效率AC排行
        /// </summary>
        public webView.hashUrl ContestAcceptedUser
        {
            get { return get("/contest/solutionRank.html"); }
        }
        /// <summary>
        /// 比赛程序测试AC排行
        /// </summary>
        public webView.hashUrl ContestAcceptedUserSubmit
        {
            get
            {
                return get("/contest/acceptedRank.html");
            }
        }
        /// <summary>
        /// 比赛排行
        /// </summary>
        public webView.hashUrl ContestRank
        {
            get
            {
                return get("/contest/problemRank.html");
            }
        }
        /// <summary>
        /// 程序测试记录
        /// </summary>
        public webView.hashUrl ContestJudge
        {
            get { return get("/contest/problemJudge.html"); }
        }
        /// <summary>
        /// 验题地址
        /// </summary>
        public webView.hashUrl Test
        {
            get { return get("/management/problemCode.html"); }
        }
        /// <summary>
        /// 用户在比赛问题下的提交记录
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public webView.hashUrl ContestSubmitList(int userId)
        {
            return new webView.hashUrl { Path = "/contest/problemSubmitList.html", Query = Query + new diantou.dataModel.path.user { Id = userId }.AndQuery };
        }
        /// <summary>
        /// Judge状态页面
        /// </summary>
        internal const string JudgeStatus = "/onlineJudge/judgeStatus.html";
        /// <summary>
        /// 问题列表页面
        /// </summary>
        internal const string List = "/onlineJudge/problemList.html";
        /// <summary>
        /// 过期问题列表页面
        /// </summary>
        internal const string ExpiredList = "/onlineJudge/expiredProblemList.html";
        /// <summary>
        /// 话题相关问题列表页面
        /// </summary>
        internal const string TopicList = "/onlineJudge/topicProblem.html";
        /// <summary>
        /// 排行榜页面
        /// </summary>
        internal const string Rank = "/onlineJudge/rankList.html";
        /// <summary>
        /// 用户的提交记录页面
        /// </summary>
        internal const string SubmitList = "/onlineJudge/submitList.html";
        /// <summary>
        /// 用户关注问题页面
        /// </summary>
        internal const string Focus = "/onlineJudge/focusProblem.html";
    }
}
